import { getSysStructsTreeApi } from './structs-tree.service';
export default {
  name: 'structs-tree',
  components: {},
  directives: {},
  data() {
    return {
      treeData: [], // 树数据
      defaultProps: { // 树属性
        children: 'children',
        label: 'text'
      },
      selectNode: {} // 选中的节点
    }
  },
  created() {
    this.getSysStructsTree()
  },
  methods: {
    // 获取部门树
    getSysStructsTree() {
      getSysStructsTreeApi().then(res => {
        this.treeData = res.data
      })
    },

    // 获取选中节点数据
    handleNodeClick(data) {
      this.selectNode = data;
      this.$emit('select', this.selectNode)
    }
  }
}
